package com.bk.st.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.bk.st.entity.User;
import com.bk.st.service.UserService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RequestMapping("/user")
@RestController
@Slf4j
public class UserController {

    @Autowired
    private UserService userService;

    @GetMapping("/list")
    @ResponseBody
    public List<User> list() {
        return userService.list();
    }

    @GetMapping("query")
    @ResponseBody
    public List<User> query(String name) {
        return userService.list(new QueryWrapper<User>().like("name", name));
    }

}
